package com.company.finance.ddd.domain.support.company.repository;

import com.company.finance.ddd.common.IRepository;
import com.company.finance.ddd.domain.support.company.entity.Company;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 *
 * @author wanglei
 * @version $$Id: CompanyRepositoryImpl, v 0.1 2021/2/4 16:56 wanglei Exp $$
 */
@Repository
public class CompanyRepository implements IRepository<Company> {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void save(Company domain) {

    }

    @Override
    public List<Company> query(Map<String, Object> queryCondition) {
        return null;
    }

    @Override
    public Company get(Long id) {
        return jdbcTemplate.queryForObject("select * from company where id = ?"
                , new BeanPropertyRowMapper<>(Company.class), id);
    }

    @Override
    public void delete(Long billId) {
        throw new UnsupportedOperationException();
    }
}
